package com.nlp.visualization.crawler.launcher;

import com.nlp.visualization.crawler.processor.Processor;
import com.nlp.visualization.crawler.processor.ProcessorCentre;

import java.util.ArrayList;
import java.util.List;

/**
 * @author LXM
 * @Title: ${file_name}
 * @Description: ${todo}
 * @date 2018/3/4下午1:18
 */
public class StartCrawler {

    private List<String> sourceClassName;

    public List<String> getSourceClassName() {
        return sourceClassName;
    }

    public void setSourceClassName(List<String> sourceClassName) {
        this.sourceClassName = sourceClassName;
    }


    public StartCrawler(List<String> sourceClassName) {
        this.sourceClassName = sourceClassName;
    }

    /**
     * 按日期爬取
     *
     * @param date
     */
    public void start(String date) {
        ProcessorCentre centre = new ProcessorCentre();
        try {
            centre.crawel(sourceClassName, date);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
    }

    /**
     * 按日期爬取
     *
     * @param date
     */
    public void start() {
        ProcessorCentre centre = new ProcessorCentre();
        try {
            centre.crawel(sourceClassName);
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("sina");
        StartCrawler startCrawler = new StartCrawler(list);
        startCrawler.start();
    }
}
